package com.rzn.reading.controller;


import com.rzn.reading.JsonResult;
import com.rzn.reading.model.dto.echarts.LikeCategoryDto;
import com.rzn.reading.model.dto.echarts.LiteratureCategoryDto;
import com.rzn.reading.model.dto.echarts.ScoreDto;
import com.rzn.reading.service.EchartsDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * echarts图表数据 前端控制器
 * </p>
 *
 * @author rzn
 * @since 2022-04-26
 */
@RestController
@RequestMapping("//echarts")
@Api(tags = "echarts图表数据")
public class EchartsDataController {
  @Autowired
  private EchartsDataService echartsDataService ;

  @GetMapping("/queryLiteratureCategory")
  @ApiOperation("查询文献类别信息")
  public JsonResult queryLiteratureCategory() {
    List<LiteratureCategoryDto> literatureCategoryDtos = echartsDataService.queryLiteratureCategory();
    return JsonResult.success(literatureCategoryDtos);
  }

  @GetMapping("/queryLikeCategory")
  @ApiOperation("查询文献类别信息")
  public JsonResult queryLikeCategory() {
    List<LikeCategoryDto> likeCategoryDtos = echartsDataService.queryLikeCategory();
    return JsonResult.success(likeCategoryDtos);
  }

  @GetMapping("/queryScore")
  @ApiOperation("查询文献类别信息")
  public JsonResult queryScore() {
    List<ScoreDto> scoreDtos = echartsDataService.queryScore();
    return JsonResult.success(scoreDtos);
  }
}

